home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / astr201.zip / ANSIVIEW.BAS < prev    next >
BASIC Source File  |  1991-02-26  |  3KB  |  96 lines

  1. ' ANSIVIEW.BAS by Duane Paulson  Version 2.01
  2. ' Simple utility to view text files containing ANSI screen control codes.
  3.  
  4. ' For Microsoft BASIC Professional Developer's System, version 7.1.
  5. ' Sorry, some functions are not compatible with QuickBASIC.
  6.  
  7. ' BASIC Professional Developer's System and QuickBASIC are trademarks of Microsoft Corporation.
  8.  
  9. ' Compiler instructions:
  10. '     8088 version:
  11. '        BC /O /Ot /Fpa /C:1 ansiview.bas, aview.obj,;
  12. '     80286 version:
  13. '        BC /O /Ot /Fpa /C:1 /G2 ansiview.bas, aview286.obj,;
  14.  
  15. ' Linker instructions:
  16. '     LINK /NOE aview[286].obj+tscnionr.obj+smallerr.obj+nolpt.obj+nocom.obj+noedit.obj,aview[286].exe,,BCL71ANR.LIB,;
  17.  
  18. CONST Title$ = "ANSIVIEW Version 2.01 ANSI file viewer by Duane Paulson 02/26/91"
  19. CONST CString$ = "Portions (C) 1982-1990 Microsoft Corporation. All rights reserved."
  20.  
  21. CONST MaxDelay% = 32268, MinDelay% = 499
  22. CONST HiByte% = &H5, LoByte% = &HE0
  23.  
  24. DEFINT A-Z
  25.  
  26. Delay = 15000
  27.  
  28. OPEN "CONS:" FOR OUTPUT AS #2
  29. PRINT #2,
  30.  
  31. FileName$ = COMMAND$
  32. IF FileName$ = "" THEN GOTO Help
  33.  
  34. IF DIR$(FileName$) = "" THEN GOTO NotFound
  35.  
  36. OPEN FileName$ FOR BINARY AS #1 LEN = 32767
  37.  
  38. DO WHILE NOT EOF(1)
  39.    a$ = INPUT$(1, 1)
  40.    PRINT #2, a$;
  41.    SELECT CASE UCASE$(INKEY$)
  42.       CASE " "
  43.          DO: LOOP WHILE INKEY$ = ""
  44.       CASE CHR$(27)
  45.          CLOSE #1
  46.          GOTO Ender
  47.       CASE "S"
  48.          IF Delay < MaxDelay THEN Delay = Delay + 500 ELSE GOSUB Blip
  49.       CASE "F"
  50.          IF Delay > MinDelay THEN Delay = Delay - 500 ELSE GOSUB Blip
  51.    END SELECT
  52.    FOR a = 0 TO Delay: NEXT a
  53. LOOP
  54.  
  55. CLOSE #1
  56. PRINT #2, CHR$(7);
  57. DO: LOOP WHILE INKEY$ = ""
  58.  
  59. GOTO Ender
  60.  
  61. NotFound:
  62.    PRINT #2, CHR$(7); "File "; FileName$; " not found."
  63.    PRINT #2,
  64.    El = 1
  65.  
  66. Help:
  67.    PRINT #2, "Syntax: aview[286] Filename"
  68.    PRINT #2,
  69.    PRINT #2, "<SPACEBAR> toggles scrolling on and off"
  70.    PRINT #2, "<F> speeds up the scrolling"
  71.    PRINT #2, "<S> slows down the scrolling"
  72.    PRINT #2, "<ESC> exits the program"
  73.    PRINT #2,
  74.  
  75. Ender:
  76.    PRINT #2,
  77.    PRINT #2, Title
  78.    PRINT #2, CString
  79.    PRINT #2,
  80.  
  81. END El
  82.  
  83. Blip:                            ' Local subroutine to produce a short
  84.    OUT 67, 182                   ' tone on the speaker. Local subroutines
  85.    OUT 66, LoByte                ' are much faster than SUBprocesses when
  86.    OUT 66, HiByte                ' you just have a simple, short routine
  87.    SpkrOn = INP(97) OR &H3       ' to handle.
  88.    OUT 97, SpkrOn
  89.  
  90.    FOR a = 1 TO 15000: NEXT a
  91.  
  92.    SpkrOff = INP(97) AND &HFC
  93.    OUT 97, SpkrOff
  94. RETURN
  95.  
  96.